package com.kongxx.struts2study.json;

import com.kongxx.struts2study.user.model.User;
import com.opensymphony.xwork2.Action;
import java.util.ArrayList;
import java.util.List;
import org.apache.struts2.json.annotations.SMDMethod;

public class JSONExample3 {

	private List<User> userList = new ArrayList<User>();
	
	public String execute() {
		return Action.SUCCESS;
	}

	@SMDMethod
	public List<User> getMyUserList(int size) {
		for (int i = 0; i < size; i++) {
			User user = new User("id_" + i, "username_" + i, "password_" + i, "desc_" + i);
			userList.add(user);
		}
		return userList;
	}

	public List<User> getUserList() {
		return userList;
	}

	public void setUserList(List<User> userList) {
		this.userList = userList;
	}
}
